package com.yoki.loginview;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.PersistableBundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class WelcomeActivity extends AppCompatActivity {
    private CountDownTimer CDT;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_welcome);
        SkipBtn = findViewById(R.id.skipBtn);

        CountDownTimer countDownTimer = new CountDownTimer(3000,1000)
        {
            @Override
            public void onTick(long l)
            {
                SkipBtn.setText(getString(R.string.skip_wait,(l/1000)));
            }
            @Override
            public void onFinish()
            {
                SkipBtn.setText("正在跳转");
                Intent intent=new Intent(WelcomeActivity.this,CloudActivity.class);
                //Intent intent=new Intent(WelcomeActivity.this,CloudActivity.class);
                startActivity(intent);
                finish();
            }
        };
        countDownTimer.start();
        CDT = countDownTimer;
    }

    private TextView SkipBtn;

    public void onClick(View view)
    {
        CDT.cancel();
        SkipBtn.setText("正在跳转");
        Intent intent=new Intent(WelcomeActivity.this,CloudActivity.class);
        //Intent intent=new Intent(WelcomeActivity.this,CloudActivity.class);
        startActivity(intent);
        finish();
    }

}
